import { Navigate } from "react-router-dom";
import { showModal } from "@/store/modules/user";
import { useSelector, useDispatch } from "react-redux";
import { useLocation, redirect } from "react-router-dom";
function AuthRoute({ children }) {
  const dispatch = useDispatch();
  const accessToken = useSelector((state: any) => state.user.accessToken);
  if (accessToken) {
    return children;
  } else {
    /*   return redirect("/home"); */
    dispatch(showModal());
  }
}

export default AuthRoute;
